#include <stdio.h>
#include <stdlib.h>
#include <iostream>

using namespace std;
typedef unsigned long long ull;

int fib(int n)
{
  ull a = 1, ta, 
      b = 1, tb,
      c = 1, rc = 0,  tc,
      d = 0, rd = 1; 
 while (n)
  { 
    if (n & 1)    
    {
      tc = rc;
      rc = rc*a + rd*c;
      rd = tc*b + rd*d;
    } 
    ta = a; tb = b; tc = c;
    a = a*a  + b*c;
    b = ta*b + b*d;
    c = c*ta + d*c;     
    d = tc*tb+ d*d;
    n >>= 1;   
  }  
  return rc;
}

int main(int argc, char *argv[])
{
	int n=atoi(argv[1]);
	cout<<fib(n)<<endl;
	return 0;
}